/*
 * @Author: intellectual-seeker 3336339701@qq.com
 * @Date: 2025-08-19 22:09:57
 * @LastEditors: intellectual-seeker 3336339701@qq.com
 * @LastEditTime: 2025-08-21 11:43:33
 * @FilePath: /code/lesson27_28/handlersignal.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include <signal.h>
#include <iostream>
using namespace std;
#include <unistd.h>
#include <sys/types.h>

void handler(int signo)
{
    cout << "handler signal success... , signum is : " << signo << endl;//ctrl + /终止
}

int main()
{
    //自定义处理信号，设置一次，整个进程运行期间都生效
    //signal(SIGINT, handler);

    //忽略指定信号
    signal(SIGINT, SIG_IGN);//宏参数SIG_IGN，对指定信号进行忽略

    while(1)
    {
        cout << "process is activing... , pid : " << getpid() << endl;
        sleep(1);
    }

    return 0;
}